// stores/counter.js
import {
	defineStore
} from 'pinia';

export const userInfo = defineStore('counter', {
	state: () => {
		return {
			token: '',
			info: {},
		};
	},
	// 实现持久化存储
	unistorage: true,
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		setToken(token) {
			this.token = token;
		},
		setInfo(info) {
			this.info = {...info}
		},
		clearAll() {
		  this.token = '';
		  this.info = {};
		}
	},
});
